//
//  EpointUIGirdViewTestViewController.m
//  EpointFrame5
//
//  Created by 李亚春 on 14-1-9.
//  Copyright (c) 2014年 Epoint. All rights reserved.
//

#import "EpointUIGirdViewTestViewController.h"
#import "UIGridViewCell.h"
#import "GridViewIconCell.h"
@interface EpointUIGirdViewTestViewController ()
{
    UIGridView *gv;
}
@end

@implementation EpointUIGirdViewTestViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    gv = [[UIGridView alloc]initWithFrame:self.getFullContentFrame];
    gv.uiGridViewDelegate = self;
    gv.separatorStyle = UITableViewCellSeparatorStyleNone;
    gv.backgroundColor = [UIColor clearColor];
    [self.view addSubview:gv];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (CGFloat) gridView:(UIGridView *)grid widthForColumnAt:(int)columnIndex
{
	return 80;
}

- (CGFloat) gridView:(UIGridView *)grid heightForRowAt:(int)rowIndex
{
	return 96;
}

- (NSInteger) numberOfColumnsOfGridView:(UIGridView *) grid
{
	return 4;
}


- (NSInteger) numberOfCellsOfGridView:(UIGridView *) grid
{
	return 33;
}

- (UIGridViewCell *) gridView:(UIGridView *)grid cellForRowAt:(int)rowIndex AndColumnAt:(int)columnIndex
{
    GridViewIconCell *cell = (GridViewIconCell *)[grid dequeueReusableCell];
    if (cell==nil) {
        NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"GridViewIconCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }
    
    return cell;
}

- (void) gridView:(UIGridView *)grid didSelectRowAt:(int)rowIndex AndColumnAt:(int)colIndex
{
	NSLog(@"%d, %d clicked", rowIndex, colIndex);
}

@end
